package com.beiding.t;

import javax.swing.*;
import java.awt.*;
import java.awt.image.BufferedImage;

public class PictureShow {

    public static void show(BufferedImage bufferedImage) {

        JFrame jFrame = new JFrame();
        jFrame.setLocation(200, 200);
        jFrame.setVisible(true);

        jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        jFrame.setSize(450, 600);

        JPanel jPanel = new JPanel(){

            // 重写paint方法
            @Override
            public void paint(Graphics graphics) {
                // 必须先调用父类的paint方法
                super.paint(graphics);

                graphics.drawImage(bufferedImage, 0, 0, this);

            }
        };
        jFrame.add(jPanel);
        jPanel.setSize(500, 500);
        jPanel.setBackground(Color.WHITE);
        jPanel.setVisible(true);
        jPanel.add(new JTextField("文件"));

    }

}